import { createRequestTypes } from '@UTILS/reduxHelper'
import { Action } from 'redux'

import { ExpertActionITF, TagIdsActionITF } from '@REDUXITF/expert'
import { PayloadITF } from '@INTERFACES/Expert'

export const GET_EXPERT_FEEDS = createRequestTypes('GET_EXPERT_FEEDS')
export const GET_EXPERT_SPECIAL_TOPIC = createRequestTypes('GET_EXPERT_SPECIAL_TOPIC')
export const GET_EXPERT_BANNER = createRequestTypes('GET_EXPERT_BANNER')
export const GET_POPULAR_SEARCH = createRequestTypes('GET_POPULAR_SEARCH')
export const GET_USER_MATCHED_TAGS = createRequestTypes('GET_USER_MATCHED_TAGS')
export const GET_EXPERT_GOODS = createRequestTypes('GET_EXPERT_GOODS')
export const GET_EXPERT_TEMPLATES = createRequestTypes('GET_EXPERT_TEMPLATES')

export default {
  dispatchGetExpertFeeds(payload: PayloadITF): ExpertActionITF {
    return {
      type: GET_EXPERT_FEEDS.REQUEST,
      payload
    }
  },
  dispatchGetExpertSpecialTopic(): Action {
    return {
      type: GET_EXPERT_SPECIAL_TOPIC.REQUEST
    }
  },
  dispatchGetExpertBanner(): Action {
    return {
      type: GET_EXPERT_BANNER.REQUEST
    }
  },
  dispatchGetPopularSearch(): Action {
    return {
      type: GET_POPULAR_SEARCH.REQUEST
    }
  },
  dispatchGetUserMatchedTags(): Action {
    return {
      type: GET_USER_MATCHED_TAGS.REQUEST
    }
  },
  dispatchGetExpertGoods(tIds: string): TagIdsActionITF {
    return {
      type: GET_EXPERT_GOODS.REQUEST,
      tIds,
    }
  },
  dispatchGetExpertTemplates(tIds: string): TagIdsActionITF {
    return {
      type: GET_EXPERT_TEMPLATES.REQUEST,
      tIds,
    }
  },
}
